#! /bin/bash
export LANG=zh_CN.UTF-8
HIVE_HOME=/usr/bin/hive	

${HIVE_HOME} -S -e "
create database if not exists checkin_dws;

drop table checkin_dws.dws_student_attend;
create table checkin_dws.dws_student_attend(
--维度
class_id int,
class_date string,
yearinfo string,
monthinfo string,
dayinfo string,
morning_attend_count bigint,
afternoon_attend_count bigint,
evening_attend_count bigint,
morning_ontime_count bigint,
afternoon_ontime_count bigint,
evening_ontime_count bigint,
morning_late_count bigint,
afternoon_late_count bigint,
evening_late_count bigint
)comment '学生出勤表'
row format delimited fields terminated by '\t'
stored as orc
tblproperties ('orc.compress' = 'SNAPPY');

drop table checkin_dws.dws_student_leave;
create table checkin_dws.dws_student_leave(
--维度
class_id int,
class_date string,
yearinfo string,
monthinfo string,
dayinfo string,
morning_leave_count bigint,
afternoon_leave_count bigint,
evening_leave_count bigint
)comment '学生请假表'
row format delimited fields terminated by '\t'
stored as orc
tblproperties ('orc.compress' = 'SNAPPY');

drop table	checkin_dws.dws_student_absent;
CREATE TABLE checkin_dws.dws_student_absent
(
    class_id               INT,
    class_date             STRING,
    yearinfo               STRING,
    monthinfo              STRING,
    dayinfo                STRING,
    morning_absent_count   BIGINT,
    afternoon_absent_count BIGINT,
    evening_absent_count   BIGINT
)comment '学生旷课表'
row format delimited fields terminated by '\t'
stored as orc
tblproperties ('orc.compress' = 'SNAPPY');
"